Object.defineProperty(exports, "__esModule", {
    value: !0
});

var r = {
    _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
    encode: function(t) {
        var e = "", o = void 0, d = void 0, i = void 0, a = void 0, h = void 0, n = void 0, C = void 0, c = 0;
        for (t = r.utf8Encode(t); c < t.length; ) a = (o = t.charCodeAt(c++)) >> 2, h = (3 & o) << 4 | (d = t.charCodeAt(c++)) >> 4, 
        n = (15 & d) << 2 | (i = t.charCodeAt(c++)) >> 6, C = 63 & i, isNaN(d) ? n = C = 64 : isNaN(i) && (C = 64), 
        e = e + this._keyStr.charAt(a) + this._keyStr.charAt(h) + this._keyStr.charAt(n) + this._keyStr.charAt(C);
        return e;
    },
    decode: function(t) {
        var e = "", o = void 0, d = void 0, i = void 0, a = void 0, h = void 0, n = void 0, C = 0;
        for (t = t.replace(/[^A-Za-z0-9\+\/\=]/g, ""); C < t.length; ) o = this._keyStr.indexOf(t.charAt(C++)) << 2 | (a = this._keyStr.indexOf(t.charAt(C++))) >> 4, 
        d = (15 & a) << 4 | (h = this._keyStr.indexOf(t.charAt(C++))) >> 2, i = (3 & h) << 6 | (n = this._keyStr.indexOf(t.charAt(C++))), 
        e += String.fromCharCode(o), 64 !== h && (e += String.fromCharCode(d)), 64 !== n && (e += String.fromCharCode(i));
        return e = r.utf8Decode(e);
    },
    utf8Encode: function(r) {
        r = r.replace(/\r\n/g, "\n");
        for (var t = "", e = 0; e < r.length; e++) {
            var o = r.charCodeAt(e);
            o < 128 ? t += String.fromCharCode(o) : o > 127 && o < 2048 ? (t += String.fromCharCode(o >> 6 | 192), 
            t += String.fromCharCode(63 & o | 128)) : (t += String.fromCharCode(o >> 12 | 224), 
            t += String.fromCharCode(o >> 6 & 63 | 128), t += String.fromCharCode(63 & o | 128));
        }
        return t;
    },
    utf8Decode: function(r) {
        for (var t = "", e = 0, o = 0, d = 0, i = 0; e < r.length; ) (o = r.charCodeAt(e)) < 128 ? (t += String.fromCharCode(o), 
        e++) : o > 191 && o < 224 ? (d = r.charCodeAt(e + 1), t += String.fromCharCode((31 & o) << 6 | 63 & d), 
        e += 2) : (d = r.charCodeAt(e + 1), i = r.charCodeAt(e + 2), t += String.fromCharCode((15 & o) << 12 | (63 & d) << 6 | 63 & i), 
        e += 3);
        return t;
    }
};

exports.default = r;